<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class News extends MY_Controller {
	function __construct(){
		parent::__construct();
		$this->load->model('page_model');
		$this->load->model('article_model');
		$this->load->model('gallery_model');
		$this->load->model('coltypes_model');
	}
	
	//交易案例
	public function index($page=1){
		/*分页*/
		$config['base_url'] = SITE_URL.'news/index/';//分页地址
		$config['uri_segment'] = 3;//页码所在URI段
		//计算当前页面新闻总条数
		$where=array('audit'=>1,'cid'=>6);
		$config['total_rows'] = $this->db->where($where)->from('article')->count_all_results();
		$config['per_page'] = 6;//每页显示的条数
		$config['use_page_numbers'] = TRUE;//默认分页URL中是显示每页记录数,启用use_page_numbers后显示的是当前页码。
		$config['cur_tag_open']= '<a class="active">';
		$config['cur_tag_close']='</a>';
		$config['full_tag_open'] = '<div class="page">';
		$config['full_tag_close'] = '</div>';
		$config['num_links']=5;
		$config['cur_tag_open']='<a href="#" class="active">';
		$config['cur_tag_close']='</a>';
		$config['prev_link']='<';
		$config['next_link']='>';
		$config['num_tag_open']='';
		$config['num_tag_close']='';
		$config['prev_tag_open']='';
		$config['prev_tag_close']='';
		$config['next_tag_open']='';
		$config['next_tag_close']='';
		$data['fenye']=$this->article_model->photo_page($config,$page,$where);
		$data['seo']=$this->db->get_where('columns',array('id'=>6))->row_array();//获取seo
		$this->load->view('case',$data);
	}
	
	public function case_info($id=''){
		$data['info']=$this->db->get_where('article',array('cid'=>6,'audit'=>1,'id'=>$id))->row_array();
		/*新闻上一页，下一页，返回*/
		$data['updown']=$this->article_model->change_page($id,$cid=6);
		$data['seo']=$this->db->get_where('article',array('id'=>$id))->row_array();//获取seo
		$this->load->view('news-info',$data);
	}
	
	
	public function msg($page=1){
		/*分页*/
		$config['base_url'] = SITE_URL.'news/msg/';//分页地址
		$config['uri_segment'] = 3;//页码所在URI段
		//计算当前页面新闻总条数
		$where=array('audit'=>1,'cid'=>7);
		$config['total_rows'] = $this->db->where($where)->from('article')->count_all_results();
		$config['per_page'] = 6;//每页显示的条数
		$config['use_page_numbers'] = TRUE;//默认分页URL中是显示每页记录数,启用use_page_numbers后显示的是当前页码。
		$config['cur_tag_open']= '<a class="active">';
		$config['cur_tag_close']='</a>';
		$config['full_tag_open'] = '<div class="page">';
		$config['full_tag_close'] = '</div>';
		$config['num_links']=5;
		$config['cur_tag_open']='<a href="#" class="active">';
		$config['cur_tag_close']='</a>';
		$config['prev_link']='<';
		$config['next_link']='>';
		$config['num_tag_open']='';
		$config['num_tag_close']='';
		$config['prev_tag_open']='';
		$config['prev_tag_close']='';
		$config['next_tag_open']='';
		$config['next_tag_close']='';
		$data['fenye']=$this->article_model->photo_page($config,$page,$where);
		$data['seo']=$this->db->get_where('columns',array('id'=>7))->row_array();//获取seo
		$this->load->view('news',$data);
	}
	
	public function msg_info($id=''){
		$data['info']=$this->db->get_where('article',array('cid'=>7,'audit'=>1,'id'=>$id))->row_array();
		/*新闻上一页，下一页，返回*/
		$data['updown']=$this->article_model->change_page($id,$cid=7);
		$data['seo']=$this->db->get_where('article',array('id'=>$id))->row_array();//获取seo
		$this->load->view('msg-info',$data);
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
}